package com.ruoyi.cms.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.mapper.CrmMemberMapper;
import com.ruoyi.cms.domain.CrmMember;
import com.ruoyi.cms.service.ICrmMemberService;

/**
 * 会员Service业务层处理
 * 
 * @author hct
 * @date 2022-10-06
 */
@Service
public class CrmMemberServiceImpl implements ICrmMemberService 
{
    @Autowired
    private CrmMemberMapper crmMemberMapper;

    /**
     * 查询会员
     * 
     * @param id 会员主键
     * @return 会员
     */
    @Override
    public CrmMember selectCrmMemberById(Long id)
    {
        return crmMemberMapper.selectCrmMemberById(id);
    }
    @Override
    public CrmMember getByMobile(String mobile){
        return crmMemberMapper.getByMobile(mobile);

    }


    /**
     * 查询会员列表
     * 
     * @param crmMember 会员
     * @return 会员
     */
    @Override
    public List<CrmMember> selectCrmMemberList(CrmMember crmMember)
    {
        return crmMemberMapper.selectCrmMemberList(crmMember);
    }

    /**
     * 新增会员
     * 
     * @param crmMember 会员
     * @return 结果
     */
    @Override
    public int insertCrmMember(CrmMember crmMember)
    {
        crmMember.setCreateTime(DateUtils.getNowDate());
        return crmMemberMapper.insertCrmMember(crmMember);
    }

    /**
     * 修改会员
     * 
     * @param crmMember 会员
     * @return 结果
     */
    @Override
    public int updateCrmMember(CrmMember crmMember)
    {
        crmMember.setUpdateTime(DateUtils.getNowDate());
        return crmMemberMapper.updateCrmMember(crmMember);
    }

    /**
     * 批量删除会员
     * 
     * @param ids 需要删除的会员主键
     * @return 结果
     */
    @Override
    public int deleteCrmMemberByIds(Long[] ids)
    {
        return crmMemberMapper.deleteCrmMemberByIds(ids);
    }

    /**
     * 删除会员信息
     * 
     * @param id 会员主键
     * @return 结果
     */
    @Override
    public int deleteCrmMemberById(Long id)
    {
        return crmMemberMapper.deleteCrmMemberById(id);
    }
}
